load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("//tools:defaults.bzl", "ts_library")

package(default_visibility = ["//visibility:public"])

nodejs_binary(
    name = "dgeni",
    data = [
        ":sources",
        "@npm//dgeni",
        "@npm//dgeni-packages",
    ],
    entry_point = ":bazel-bin.ts",
    # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver
    # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324
    templated_args = ["--bazel_patch_module_resolver"],
)

ts_library(
    name = "sources",
    srcs = glob(["**/*.ts"]),
    tsconfig = ":tsconfig.json",
    deps = [
        "//tools/highlight-files:sources",
        "@npm//@types/node",
        "@npm//dgeni",
        "@npm//dgeni-packages",
        "@npm//highlight.js",
        "@npm//typescript",
    ],
)
